package com.blrs.service.supplier.impl;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;

import com.blrs.common.core.domain.entity.SysDept;
import com.blrs.common.utils.SecurityUtils;
import com.blrs.common.utils.StringUtils;
import com.blrs.domain.CollaborativeManagement;
import com.blrs.domain.EnterprisePersonInfo;
import com.blrs.domain.SupplierBank;
import com.blrs.domain.vo.SupplierBankCountVo;
import com.blrs.mapper.CollaborativeManagementMapper;
import com.blrs.mapper.EnterprisePersonInfoMapper;
import com.blrs.mapper.SupplierBankMapper;
import com.blrs.system.mapper.SysDeptMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.blrs.mapper.SupplierInfoMapper;
import com.blrs.domain.SupplierInfo;
import com.blrs.service.supplier.ISupplierInfoService;

/**
 * 【供应商信息】Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-05-17
 */
@Service
public class SupplierInfoServiceImpl implements ISupplierInfoService 
{
    @Autowired
    private SupplierInfoMapper supplierInfoMapper;
    @Autowired
    private EnterprisePersonInfoMapper enterprisePersonInfoMapper;
    @Autowired
    private SysDeptMapper sysDeptMapper;
    @Autowired
    private SupplierBankMapper supplierBankMapper;
    @Autowired
    private CollaborativeManagementMapper collaborativeManagementMapper;
    /**
     * 查询【供应商信息】
     * 
     * @param enterpriseId 【供应商信息】主键
     * @return 【供应商信息】
     */
    @Override
    public SupplierInfo selectSupplierInfoByEnterpriseId(String enterpriseId)
    {
        return supplierInfoMapper.selectSupplierInfoByEnterpriseId(enterpriseId);
    }

    @Override
    public SupplierInfo selectEnterpriseNameByName(String enterpriseName, String belongTo) {
        return supplierInfoMapper.selectEnterpriseNameByName(enterpriseName, belongTo);
    }

    /**
     * 查询【供应商信息】列表
     * 
     * @param supplierInfo 【供应商信息】
     * @return 【供应商信息】
     */
    @Override
    public List<SupplierInfo> selectSupplierInfoList(SupplierInfo supplierInfo)
    {
        supplierInfo.setBelongTo(SecurityUtils.getOrgId().toString());
        List<SupplierInfo> supplierInfos = supplierInfoMapper.selectSupplierInfoList(supplierInfo);
        for (SupplierInfo info : supplierInfos) {
            if (info.getEnterpriseOrgId()==0){
                //说明当前企业存在合作，注册状态为已注册
                info.setRegisterStatus(0);
            }else {
                //说明当前企业不存在合作，注册状态为未注册
                info.setRegisterStatus(1);
            }
        }
        return supplierInfos;
    }

    @Override
    public List<SupplierInfo> selectSupplierListToActivity(SupplierInfo supplierInfo) {
        return supplierInfoMapper.selectSupplierListToActivity(supplierInfo);
    }

    @Override
    public List<SupplierInfo> selectCooperativeRelationshipList(SupplierInfo supplierInfo) {
        return supplierInfoMapper.selectCooperativeRelationshipList(supplierInfo);
    }

    /**
     * 新增【供应商信息】
     * 
     * @param supplierInfo 【供应商信息】
     * @return 结果
     */
    @Override
    public int insertSupplierInfo(SupplierInfo supplierInfo)
    {
        int count = 0;
        SupplierInfo supplier = supplierInfoMapper.selectEnterpriseNameByName(supplierInfo.getEnterpriseName(),SecurityUtils.getOrgId().toString());
        SysDept sysDept = new SysDept();
        sysDept.setDeptName(supplierInfo.getEnterpriseName());
        sysDept.setCompanyType("0");
        SysDept dept = sysDeptMapper.selectDeptByDeptName(sysDept);
        if(supplier!=null){
            throw new RuntimeException("该企业名称在供应商或平台关系中已存在！！");
        }else if(dept!=null&&supplier==null){
            throw new RuntimeException("该企业已入驻平台，请到合作管理建立合作！");
        }else{
            supplierInfo.setCreationId(SecurityUtils.getUserId().toString());
            supplierInfo.setCreationName(SecurityUtils.getUsername());
            supplierInfo.setCreationTime(new Timestamp(new Date().getTime()));
            supplierInfo.setOperateId(SecurityUtils.getUserId());
            supplierInfo.setOperateTime(new Timestamp(new Date().getTime()));
            supplierInfo.setDepartmentId(SecurityUtils.getDeptId());
            supplierInfo.setDepartmentName(SecurityUtils.getLoginUser().getUser().getDept().getDeptName());
            supplierInfo.setOrganizationId(SecurityUtils.getOrgId());
            supplierInfo.setOrganizationName(SecurityUtils.getOrgName());
            supplierInfo.setBelongTo(SecurityUtils.getOrgId().toString());
            supplierInfo.setDelFlag("0");
            count = supplierInfoMapper.insertSupplierInfo(supplierInfo);
            EnterprisePersonInfo info = new EnterprisePersonInfo();
            info.setPhone(supplierInfo.getTelephone());
            info.setEnterpriseName(supplierInfo.getEnterpriseName());
            info.setOrganizationId(SecurityUtils.getOrgId());
            List<EnterprisePersonInfo> personInfoList = enterprisePersonInfoMapper.selectEnterprisePersonInfoListByPhone(info);
            if (personInfoList.size() == 0) {
                EnterprisePersonInfo personInfo = new EnterprisePersonInfo();
                personInfo.setId(UUID.randomUUID().toString());
                personInfo.setPhone(supplierInfo.getTelephone());
                personInfo.setName(supplierInfo.getContacts());
                personInfo.setEnterpriseName(supplierInfo.getEnterpriseName());
                personInfo.setEnterpriseId(supplierInfo.getEnterpriseId());
                personInfo.setCreateId(SecurityUtils.getUserId());
                personInfo.setOrganizationId(SecurityUtils.getOrgId());
                personInfo.setOrganizationName(SecurityUtils.getOrgName());
                personInfo.setFilingTime(new Timestamp(new Date().getTime()));
                personInfo.setCreationTime(new Timestamp(new Date().getTime()));
                personInfo.setOperateTime(new Timestamp(new Date().getTime()));
                personInfo.setDelFlag(0);
                enterprisePersonInfoMapper.insertEnterprisePersonInfo(personInfo);
            } else {
                EnterprisePersonInfo enterprisePersonInfo = enterprisePersonInfoMapper.selectEnterprisePersonInfoById(personInfoList.get(0).getId());
                enterprisePersonInfo.setName(supplierInfo.getContacts());
                enterprisePersonInfo.setEnterpriseName(supplierInfo.getEnterpriseName());
                enterprisePersonInfo.setEnterpriseId(supplierInfo.getEnterpriseId());
                enterprisePersonInfo.setOrganizationId(SecurityUtils.getOrgId());
                enterprisePersonInfo.setOrganizationName(SecurityUtils.getOrgName());
                enterprisePersonInfo.setOperateTime(new Timestamp(new Date().getTime()));
                enterprisePersonInfoMapper.updateEnterprisePersonInfo(enterprisePersonInfo);
            }
        }

        return count;
    }

    /**
     * 修改【供应商信息】
     * 
     * @param supplierInfo 【供应商信息】
     * @return 结果
     */
    @Override
    public int updateSupplierInfo(SupplierInfo supplierInfo)
    {
       int count = 0;
       SupplierInfo supplier = supplierInfoMapper.selectEnterpriseNameByName(supplierInfo.getEnterpriseName(),SecurityUtils.getOrgId().toString());
       SupplierInfo supplierInfo1 = supplierInfoMapper.selectSupplierInfoByEnterpriseId(supplierInfo.getEnterpriseId());
        SysDept sysDept = new SysDept();
        sysDept.setDeptName(supplierInfo.getEnterpriseName());
        sysDept.setCompanyType("0");
        SysDept dept = sysDeptMapper.selectDeptByDeptName(sysDept);
       if(supplier!=null && !supplier.getEnterpriseId().equals(supplierInfo.getEnterpriseId())){
            throw new RuntimeException("该企业名称在供应商或平台关系中已存在！！");
        }else{
            if(supplier==null&&supplierInfo1==null){
                count = insertSupplierInfo(supplierInfo);
            }else if(dept!=null&&supplier==null){
                throw new RuntimeException("该企业已入驻平台，请到合作管理建立合作！");
            }else{
                supplierInfo.setOperateId(SecurityUtils.getUserId());
                supplierInfo.setOperateTime(new Timestamp(new Date().getTime()));
                supplierInfo.setFollowTime(new Timestamp(new Date().getTime()));
                count = supplierInfoMapper.updateSupplierInfo(supplierInfo);
                EnterprisePersonInfo info = new EnterprisePersonInfo();
                info.setPhone(supplierInfo.getTelephone());
                info.setEnterpriseName(supplierInfo.getEnterpriseName());
                info.setOrganizationId(SecurityUtils.getOrgId());
                List<EnterprisePersonInfo> personInfoList = enterprisePersonInfoMapper.selectEnterprisePersonInfoListByPhone(info);
                if (personInfoList.size() == 0) {
                    EnterprisePersonInfo personInfo = new EnterprisePersonInfo();
                    personInfo.setId(UUID.randomUUID().toString());
                    personInfo.setPhone(supplierInfo.getTelephone());
                    personInfo.setName(supplierInfo.getContacts());
                    personInfo.setEnterpriseName(supplierInfo.getEnterpriseName());
                    personInfo.setEnterpriseId(supplierInfo.getEnterpriseId());
                    personInfo.setCreateId(SecurityUtils.getUserId());
                    personInfo.setOrganizationId(SecurityUtils.getOrgId());
                    personInfo.setOrganizationName(SecurityUtils.getOrgName());
                    personInfo.setFilingTime(new Timestamp(new Date().getTime()));
                    personInfo.setCreationTime(new Timestamp(new Date().getTime()));
                    personInfo.setOperateTime(new Timestamp(new Date().getTime()));
                    personInfo.setDelFlag(0);
                    enterprisePersonInfoMapper.insertEnterprisePersonInfo(personInfo);
                } else {
                    EnterprisePersonInfo enterprisePersonInfo = enterprisePersonInfoMapper.selectEnterprisePersonInfoById(personInfoList.get(0).getId());
                    enterprisePersonInfo.setName(supplierInfo.getContacts());
                    enterprisePersonInfo.setEnterpriseName(supplierInfo.getEnterpriseName());
                    enterprisePersonInfo.setEnterpriseId(supplierInfo.getEnterpriseId());
                    enterprisePersonInfo.setOrganizationId(SecurityUtils.getOrgId());
                    enterprisePersonInfo.setOrganizationName(SecurityUtils.getOrgName());
                    enterprisePersonInfo.setOperateTime(new Timestamp(new Date().getTime()));
                    enterprisePersonInfoMapper.updateEnterprisePersonInfo(enterprisePersonInfo);
                }
            }
        }
        return count;
    }

    /**
     * 批量删除【供应商信息】
     * 
     * @param enterpriseIds 需要删除的【供应商信息】主键
     * @return 结果
     */
    @Override
    public int deleteSupplierInfoByEnterpriseIds(String[] enterpriseIds)
    {
        return supplierInfoMapper.deleteSupplierInfoByEnterpriseIds(enterpriseIds);
    }

    /**
     * 删除【供应商信息】信息
     * 
     * @param enterpriseId 【供应商信息】主键
     * @return 结果
     */
    @Override
    public int deleteSupplierInfoByEnterpriseId(String enterpriseId)
    {
        return supplierInfoMapper.deleteSupplierInfoByEnterpriseId(enterpriseId);
    }

    @Override
    public String getMaxEnterpriseNo(String belongTo,String industryType) {
        return supplierInfoMapper.getMaxEnterpriseNo(belongTo,industryType);
    }

    @Override
    public int saveSupplierInfoList(SupplierBankCountVo supplierBankCountVo) {
        int count = 0;
        SupplierInfo supplier = supplierInfoMapper.selectEnterpriseNameByName(supplierBankCountVo.getEnterpriseName(),SecurityUtils.getOrgId().toString());
        if(supplier!=null){
            throw new RuntimeException("该企业名称在供应商或平台关系中已存在！！");
        }else{
            SupplierInfo supplierInfo = new SupplierInfo();
            supplierInfo.setEnterpriseId(supplierBankCountVo.getEnterpriseId());
            supplierInfo.setEnterpriseOrgId(0L);
            supplierInfo.setEnterpriseName(supplierBankCountVo.getEnterpriseName());
            supplierInfo.setAdministrativeArea(supplierBankCountVo.getAdministrativeArea());
            supplierInfo.setEnterpriseNature(supplierBankCountVo.getEnterpriseNature());
            supplierInfo.setEnterpriseNo(supplierBankCountVo.getEnterpriseNo());
            supplierInfo.setRegisteredCapital(supplierBankCountVo.getRegisteredCapital());
            supplierInfo.setEnterpriseSource(supplierBankCountVo.getEnterpriseSource());
            supplierInfo.setSupplierType(supplierBankCountVo.getSupplierType());
            supplierInfo.setEnterpriseAddress(supplierBankCountVo.getEnterpriseAddress());
            supplierInfo.setIndustryType(supplierBankCountVo.getIndustryType());
            supplierInfo.setIndustry(supplierBankCountVo.getIndustry());
            supplierInfo.setLegalRepresentative(supplierBankCountVo.getLegalRepresentative());
            supplierInfo.setEstablishmentDate(supplierBankCountVo.getEstablishmentDate());
            supplierInfo.setContacts(supplierBankCountVo.getContacts());
            supplierInfo.setTelephone(supplierBankCountVo.getTelephone());
            supplierInfo.setStatus(supplierBankCountVo.getStatus());
            supplierInfo.setCreationTime(supplierBankCountVo.getCreationTime());
            supplierInfo.setBusinessScope(supplierBankCountVo.getBusinessScope());
            supplierInfo.setType(supplierBankCountVo.getType());
            supplierInfo.setProcurementPersonnel(supplierBankCountVo.getProcurementPersonnel());
            supplierInfo.setPosition(supplierBankCountVo.getPosition());
            supplierInfo.setCreationId(SecurityUtils.getUserId().toString());
            supplierInfo.setCreationName(SecurityUtils.getUsername());
            supplierInfo.setCreationTime(new Timestamp(new Date().getTime()));
            supplierInfo.setOperateId(SecurityUtils.getUserId());
            supplierInfo.setOperateTime(new Timestamp(new Date().getTime()));
            supplierInfo.setDepartmentId(SecurityUtils.getDeptId());
            supplierInfo.setDepartmentName(SecurityUtils.getLoginUser().getUser().getDept().getDeptName());
            supplierInfo.setOrganizationId(SecurityUtils.getOrgId());
            supplierInfo.setOrganizationName(SecurityUtils.getOrgName());
            supplierInfo.setBelongTo(SecurityUtils.getOrgId().toString());
            supplierInfo.setDelFlag("0");
            supplierInfo.setProcurementPersonnelId(supplierBankCountVo.getProcurementPersonnelId());
            supplierInfo.setOperationCompany(supplierBankCountVo.getOperationCompany());
            supplierInfo.setOperationCompanyId(supplierBankCountVo.getOperationCompanyId());
            count = supplierInfoMapper.insertSupplierInfo(supplierInfo);
            EnterprisePersonInfo info = new EnterprisePersonInfo();
            info.setPhone(supplierBankCountVo.getTelephone());
            info.setEnterpriseName(supplierBankCountVo.getEnterpriseName());
            info.setOrganizationId(SecurityUtils.getOrgId());
            List<EnterprisePersonInfo> personInfoList = enterprisePersonInfoMapper.selectEnterprisePersonInfoListByPhone(info);
            if (personInfoList.size() == 0) {
                EnterprisePersonInfo personInfo = new EnterprisePersonInfo();
                personInfo.setId(UUID.randomUUID().toString());
                personInfo.setPhone(supplierBankCountVo.getTelephone());
                personInfo.setName(supplierBankCountVo.getContacts());
                personInfo.setEnterpriseName(supplierBankCountVo.getEnterpriseName());
                personInfo.setEnterpriseId(supplierBankCountVo.getEnterpriseId());
                personInfo.setCreateId(SecurityUtils.getUserId());
                personInfo.setOrganizationId(SecurityUtils.getOrgId());
                personInfo.setOrganizationName(SecurityUtils.getOrgName());
                personInfo.setFilingTime(new Timestamp(new Date().getTime()));
                personInfo.setCreationTime(new Timestamp(new Date().getTime()));
                personInfo.setOperateTime(new Timestamp(new Date().getTime()));
                personInfo.setDelFlag(0);
                enterprisePersonInfoMapper.insertEnterprisePersonInfo(personInfo);
            } else {
                EnterprisePersonInfo enterprisePersonInfo = enterprisePersonInfoMapper.selectEnterprisePersonInfoById(personInfoList.get(0).getId());
                enterprisePersonInfo.setName(supplierBankCountVo.getContacts());
                enterprisePersonInfo.setEnterpriseName(supplierBankCountVo.getEnterpriseName());
                enterprisePersonInfo.setEnterpriseId(supplierBankCountVo.getEnterpriseId());
                enterprisePersonInfo.setOrganizationId(SecurityUtils.getOrgId());
                enterprisePersonInfo.setOrganizationName(SecurityUtils.getOrgName());
                enterprisePersonInfo.setOperateTime(new Timestamp(new Date().getTime()));
                enterprisePersonInfoMapper.updateEnterprisePersonInfo(enterprisePersonInfo);
            }
            List<SupplierBank> supplierBankList = supplierBankCountVo.getSupplierBankList();
            for(int a =0;a<supplierBankList.size();a++){
                SupplierBank supplierBank = new SupplierBank();
                supplierBank.setId(supplierBankList.get(a).getId());
                supplierBank.setEnterpriseId(supplierBankList.get(a).getEnterpriseId());
                supplierBank.setBank(supplierBankList.get(a).getBank());
                supplierBank.setAccountNumber(supplierBankList.get(a).getAccountNumber());
                supplierBankMapper.insertSupplierBank(supplierBank);
            }
        }

        return count;
    }

    @Override
    public int updateSupplierInfoList(SupplierBankCountVo supplierBankCountVo) {
        int count = 0;
        SupplierInfo supplier = supplierInfoMapper.selectEnterpriseNameByName(supplierBankCountVo.getEnterpriseName(),SecurityUtils.getOrgId().toString());
        SupplierInfo supplierInfo1 = supplierInfoMapper.selectSupplierInfoByEnterpriseId(supplierBankCountVo.getEnterpriseId());
        if(supplier!=null && !supplier.getEnterpriseId().equals(supplierBankCountVo.getEnterpriseId())){
            throw new RuntimeException("该企业名称在供应商或平台关系中已存在！！");
        }else{
            if(supplier==null&&supplierInfo1==null){
                count = saveSupplierInfoList(supplierBankCountVo);
            }else{
                supplierInfo1.setEnterpriseName(supplierBankCountVo.getEnterpriseName());
                supplierInfo1.setAdministrativeArea(supplierBankCountVo.getAdministrativeArea());
                supplierInfo1.setEnterpriseNature(supplierBankCountVo.getEnterpriseNature());
                supplierInfo1.setEnterpriseNo(supplierBankCountVo.getEnterpriseNo());
                supplierInfo1.setRegisteredCapital(supplierBankCountVo.getRegisteredCapital());
                supplierInfo1.setEnterpriseSource(supplierBankCountVo.getEnterpriseSource());
                supplierInfo1.setSupplierType(supplierBankCountVo.getSupplierType());
                supplierInfo1.setEnterpriseAddress(supplierBankCountVo.getEnterpriseAddress());
                supplierInfo1.setIndustryType(supplierBankCountVo.getIndustryType());
                supplierInfo1.setIndustry(supplierBankCountVo.getIndustry());
                supplierInfo1.setLegalRepresentative(supplierBankCountVo.getLegalRepresentative());
                supplierInfo1.setEstablishmentDate(supplierBankCountVo.getEstablishmentDate());
                supplierInfo1.setContacts(supplierBankCountVo.getContacts());
                supplierInfo1.setPosition(supplierBankCountVo.getPosition());
                supplierInfo1.setTelephone(supplierBankCountVo.getTelephone());
                supplierInfo1.setStatus(supplierBankCountVo.getStatus());
                supplierInfo1.setCreationTime(supplierBankCountVo.getCreationTime());
                supplierInfo1.setBusinessScope(supplierBankCountVo.getBusinessScope());
                supplierInfo1.setOperateId(SecurityUtils.getUserId());
                supplierInfo1.setProcurementPersonnel(supplierBankCountVo.getProcurementPersonnel());
                supplierInfo1.setOperateTime(new Timestamp(new Date().getTime()));
                supplierInfo1.setEndTime(supplierBankCountVo.getEndTime());
                supplierInfo1.setSignTime(supplierBankCountVo.getSignTime());
                supplierInfo1.setProcurementPersonnelId(supplierBankCountVo.getProcurementPersonnelId());
                supplierInfo1.setOperationCompany(supplierBankCountVo.getOperationCompany());
                supplierInfo1.setOperationCompanyId(supplierBankCountVo.getOperationCompanyId());
                count = supplierInfoMapper.updateSupplierInfo(supplierInfo1);
                EnterprisePersonInfo info = new EnterprisePersonInfo();
                info.setPhone(supplierBankCountVo.getTelephone());
                info.setEnterpriseName(supplierBankCountVo.getEnterpriseName());
                info.setOrganizationId(SecurityUtils.getOrgId());
                List<EnterprisePersonInfo> personInfoList = enterprisePersonInfoMapper.selectEnterprisePersonInfoListByPhone(info);
                if (personInfoList.size() == 0) {
                    EnterprisePersonInfo personInfo = new EnterprisePersonInfo();
                    personInfo.setId(UUID.randomUUID().toString());
                    personInfo.setPhone(supplierBankCountVo.getTelephone());
                    personInfo.setName(supplierBankCountVo.getContacts());
                    personInfo.setEnterpriseName(supplierBankCountVo.getEnterpriseName());
                    personInfo.setEnterpriseId(supplierBankCountVo.getEnterpriseId());
                    personInfo.setCreateId(SecurityUtils.getUserId());
                    personInfo.setOrganizationId(SecurityUtils.getOrgId());
                    personInfo.setOrganizationName(SecurityUtils.getOrgName());
                    personInfo.setFilingTime(new Timestamp(new Date().getTime()));
                    personInfo.setCreationTime(new Timestamp(new Date().getTime()));
                    personInfo.setOperateTime(new Timestamp(new Date().getTime()));
                    personInfo.setDelFlag(0);
                    enterprisePersonInfoMapper.insertEnterprisePersonInfo(personInfo);
                } else {
                    EnterprisePersonInfo enterprisePersonInfo = enterprisePersonInfoMapper.selectEnterprisePersonInfoById(personInfoList.get(0).getId());
                    enterprisePersonInfo.setName(supplierBankCountVo.getContacts());
                    enterprisePersonInfo.setEnterpriseName(supplierBankCountVo.getEnterpriseName());
                    enterprisePersonInfo.setEnterpriseId(supplierBankCountVo.getEnterpriseId());
                    enterprisePersonInfo.setOrganizationId(SecurityUtils.getOrgId());
                    enterprisePersonInfo.setOrganizationName(SecurityUtils.getOrgName());
                    enterprisePersonInfo.setOperateTime(new Timestamp(new Date().getTime()));
                    enterprisePersonInfoMapper.updateEnterprisePersonInfo(enterprisePersonInfo);
                }
                supplierBankMapper.deleteSupplierBankByEnterpriseId(supplierBankCountVo.getEnterpriseId());
                List<SupplierBank> supplierBankList = supplierBankCountVo.getSupplierBankList();
                for(int a =0;a<supplierBankList.size();a++){
                    SupplierBank supplierBank = new SupplierBank();
                    supplierBank.setId(supplierBankList.get(a).getId());
                    supplierBank.setEnterpriseId(supplierBankList.get(a).getEnterpriseId());
                    supplierBank.setBank(supplierBankList.get(a).getBank());
                    supplierBank.setAccountNumber(supplierBankList.get(a).getAccountNumber());
                    supplierBankMapper.insertSupplierBank(supplierBank);
                }
            }
        }
        return count;
    }

    //根据id查询该平台的所有已经合作的机构id
    @Override
    public List<Long> selectPlatformOrganization(Long deptId) {
        CollaborativeManagement collaborativeManagement = new CollaborativeManagement();
        collaborativeManagement.setOrgId(String.valueOf(deptId));
        List<CollaborativeManagement> collaborativeManagements = collaborativeManagementMapper.selectCollaborativeManagementList(collaborativeManagement);
        List<Long> collect=new ArrayList<>();
        //从collaborativeManagements遍历出newName
        for(CollaborativeManagement c:collaborativeManagements){
            collect.add(Long.valueOf(c.getNewId()));
            }
        return  collect;
    }

    @Override
    public List<SysDept> selectSupplierInfoListByDeptId(List<Long> list, String deptName) {
       return sysDeptMapper.selectDeptListByPlatform(list,deptName);
    }
}
